#include <log4cpp/Category.hh>
#include <log4cpp/PropertyConfigurator.hh>

int main(void)
{
	log4cpp::PropertyConfigurator::configure("log4cpp.properties");

    // 以下其实并非真正创建，只是起了一个引用别名来绑定，在进行配置之前就已经创建过
	log4cpp::Category& root = log4cpp::Category::getRoot();
	log4cpp::Category& sub1 = log4cpp::Category::getInstance("sub1");
	log4cpp::Category& sub2 = log4cpp::Category::getInstance("sub1.sub2");

    root.warn("Read configuration completed!");
	sub1.info("Read configuration completed!");
	sub2.info("Read configuration completed!");

	log4cpp::Category::shutdown();

	return 0;
}